package com.my.context;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.ibatis.logging.LogFactory;


public class ContextListener implements ServletContextListener {

	public ContextListener() {
	}

	/**
	 * Web应用程序启动相关处理
	 */
	public void contextInitialized(ServletContextEvent sce) {
		try {
			System.out.println("服务初始化...");

			LogFactory.useLog4JLogging();

			System.out.println("服务初始化完毕...");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	 * Web应用程序停止相关处理
	 */
	public void contextDestroyed(ServletContextEvent sce) {
		try {
			System.out.println("停止前系统资源处理...");
			System.out.println("停止...");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
